textview: Use snapshot on the sidebars
authorBenjamin Otte <otte@redhat.com>
Tue, 10 Jul 2018 11:05:21 +0000 (13:05 +0200)
committerBenjamin Otte <otte@redhat.com>
Fri, 13 Jul 2018 12:56:04 +0000 (14:56 +0200)
gtk/gtktextview.c

index e7440badb0d3ebc6718e86543081400158b9d906..11cfecd986ceea8701573be2f7c3bb118c43e2ae 100644 (file)
@@ -5386,7 +5386,7 @@ draw_text (GtkWidget *widget,
 
 static void
 paint_border_window (GtkTextView     *text_view,
-                     cairo_t         *cr,
+                     GtkSnapshot     *snapshot,
                      GtkTextWindow   *text_window,
                      GtkStyleContext *context)
 {
@@ -5400,9 +5400,7 @@ paint_border_window (GtkTextView     *text_view,
 
   gtk_style_context_save_to_node (context, text_window->css_node);
 
-  cairo_save (cr);
-  gtk_render_background (context, cr, 0, 0, w, h);
-  cairo_restore (cr);
+  gtk_snapshot_render_background (snapshot, context, 0, 0, w, h);
 
   gtk_style_context_restore (context);
 }
@@ -5434,15 +5432,13 @@ gtk_text_view_snapshot (GtkWidget   *widget,
 
   cairo_save (cr);
   draw_text (widget, cr); 
-  cairo_restore (cr);
-
-  paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->left_window, context);
-  paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->right_window, context);
-  paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->top_window, context);
-  paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->bottom_window, context);
-
   cairo_destroy (cr);
 
+  paint_border_window (GTK_TEXT_VIEW (widget), snapshot, priv->left_window, context);
+  paint_border_window (GTK_TEXT_VIEW (widget), snapshot, priv->right_window, context);
+  paint_border_window (GTK_TEXT_VIEW (widget), snapshot, priv->top_window, context);
+  paint_border_window (GTK_TEXT_VIEW (widget), snapshot, priv->bottom_window, context);
+
   /* Propagate exposes to all unanchored children. 
    * Anchored children are handled in gtk_text_view_paint(). 
    */